<template>
	<view>
		<view class="idinfo margin30 bor-ra">
			<view class="address-edit">
				<view class="form bg-white">
					<u-field v-model="real_name" label="姓名" placeholder="请填写姓名"></u-field>
					<u-field v-model="mobile" label="联系方式" placeholder="请填写手机号码"></u-field>
					<u-field v-model="order_time" label="到店时间" placeholder="请选择到店时间"@tap="birthday=true"></u-field>
					<u-picker v-model="birthday" mode="time":params="params" @confirm="confirmbirthday"></u-picker>
				</view>
			</view>
		</view>
		<view class="submit-s" @click="getuserorder()">
			提交
		</view>
	</view>
</template>

<script>
	import {
			userorder,
		} from '@/api/order';
	export default {
		data() {
			return {
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
				},
				order_id:'',
				real_name:'',
				mobile:'',
				order_time:'',
				birthday: false,
				
			}
		},
		onLoad(option) {
			this.order_id = option.order_id;
		},
		methods: {
			confirmbirthday(e){
				this.order_time = e.year + '-' +e.month + '-' +e.day + ' ' + e.hour +":00"
			},
			async getuserorder(order_id){
				const {
					data,
					code,
					msg
				} = await userorder({
					order_id: this.order_id,
					real_name: this.real_name,
					mobile: this.mobile,
					order_time:this.order_time
				})
				if (code == 1) {
					this.$toast({ title: msg })
					setTimeout(()=>{
						uni.navigateTo({
							url:'/pages/mine/orderList?type=all'
						})
					}, 1500)
				}
			},
		}
	}
</script>

<style>
	page{
		background-color: #f8f8f8;
	}
	.idinfo{
		background-color: #fff;
		margin-top: 30rpx;
		padding: 32rpx 26rpx;
	}
	.submit-s{
		margin-top: 200rpx;
		padding: 16rpx;
		background-color: #f5335e;
		border-radius: 50rpx;
	}
</style>
